//
//  OurViewController.m
//  fruitsbuy3
//
//  Created by sgone-2 on 15/9/19.
//  Copyright (c) 2015年 sgone. All rights reserved.
//

#import "OurViewController.h"
#import "Common.h"
#import "DataSingleton.h"
#import "MBProgressHUD+MJ.h"
@interface OurViewController ()<UIWebViewDelegate>
@property(nonatomic,strong) DataSingleton *dataHandler;

@property(nonatomic,strong) UIView *topView;
@property(nonatomic,strong) UILabel *xinxiLab;
@property(nonatomic,strong) UIButton *backBut;


@property (weak, nonatomic) IBOutlet UIWebView *myWebView;


@end

@implementation OurViewController

//隐藏tabbar
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.hidesBottomBarWhenPushed = YES;
    }
    return self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    //设置状态栏的字体颜色为白色
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    
    self.dataHandler = [DataSingleton sharedDataSingleton];
    
    
    self.topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ViewWidth, 64)];
    self.topView.backgroundColor = BenSe_COLOR;
    [self.view addSubview:self.topView];
    self.xinxiLab = [[UILabel alloc]init];
    [self.xinxiLab sizeToFit];
    self.xinxiLab.frame = CGRectMake(0,40,320 ,30);
    self.xinxiLab.center = CGPointMake(self.topView.bounds.size.width/2, self.topView.bounds.size.height-24);
    
    self.xinxiLab.backgroundColor = [UIColor clearColor];
    self.xinxiLab.textAlignment =  NSTextAlignmentCenter;
    self.xinxiLab.textColor = [UIColor whiteColor];
//    self.xinxiLab.font = [UIFont fontWithName:@"Helvetica-Bold" size:17];
    self.xinxiLab.font = [UIFont systemFontOfSize:19];
    self.xinxiLab.text = @"关于我们";
    [self.topView addSubview:self.xinxiLab];
    
    
    
    //NSURL *url =[NSURL URLWithString:@"http://app.sgone.cn/mall_v4/home/activity_share"];
    
    
    
    NSURL *url = [NSURL URLWithString:@"http://app.sgone.cn/maboutus.html"];
    NSURLRequest * request =[NSURLRequest requestWithURL:url];
    [self.myWebView loadRequest:request];
    self.myWebView.delegate = self;
    
    
    [self backMain58];


    
}

-(void)backMain58
{
    
    self.backBut=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.backBut addTarget:self action:@selector(back58:) forControlEvents:UIControlEventTouchUpInside];
    [self.backBut setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    [self.backBut setFrame:CGRectMake(0, 14, 50, 50)];
    [self.topView addSubview:self.backBut];
    
    
}
- (void)back58:(id)sender {
    
    [self.navigationController popViewControllerAnimated:YES];
    
}



//开始加载数据
- (void)webViewDidStartLoad:(UIWebView *)webView {
    
    [MBProgressHUD showHUDAddedTo:self.myWebView animated:YES];
    
    
}


//数据加载完
- (void)webViewDidFinishLoad:(UIWebView *)webView {
    
    
    [MBProgressHUD hideAllHUDsForView:self.myWebView animated:YES];
    
}
@end
